
#pragma once
#include <vsg/all.h>

namespace qbe::input {

class WindowHandle : public vsg::Inherit<vsg::Visitor, WindowHandle> {
 public:
  void apply(vsg::ConfigureWindowEvent& e) override {
    configure_window = true;
    configure_window_event = &e;
  };
  void apply(vsg::CloseWindowEvent& e) override {
    close_window = true;
    close_window_event = &e;
  };

  bool resized(uint32_t* x, uint32_t* y, uint32_t* width, uint32_t* height) {
    if (configure_window) {
      *x = configure_window_event->x;
      *y = configure_window_event->y;
      *width = configure_window_event->width + 16;
      *height = configure_window_event->height + 39;
      return true;
    }
    return false;
  }

  void reset() { configure_window = false; };

  bool configure_window{false};
  vsg::ConfigureWindowEvent* configure_window_event{nullptr};

  bool close_window{false};
  vsg::CloseWindowEvent* close_window_event{nullptr};
};

}  // namespace qbe::input